home *** CD-ROM | disk | FTP | other *** search
- program LastLog;
-
- { Lastlog.com was written to provide the LAN user }
- { with a little more comfort in knowing that no one }
- { has been using his LOGIN_NAME. }
- { }
- { Lastlog will display the time and date when a user }
- { last logged into the LAN. }
- { It accepts a parameter which is used to specify }
- { the filename of the individual's LASTLOG file. }
- { If no file exists, (first time it is run), a new }
- { file is created in the user's HOME directory. }
- { All users have a Home directory that has the }
- { same name as their LOGIN_NAME }
- { Lastlog is invoked by a common Login Script that }
- { is used by all LAN users. }
- { Here is our current Login Script. }
- { ************************************************** }
- { MAP DISPLAY ON }
- { DOS SET USER = "%LOGIN_NAME" }
- { WRITE "Logging in: %FULL_NAME on %DAY_OF_WEEK "; }
- { write "%MONTH_NAME %DAY at %HOUR:%MINUTE %AM_PM" }
- { MAP DISPLAY OFF }
- { MAP S1:=SYS:PUBLIC }
- { MAP S2:=SYS:WIN }
- { MAP S3:=SYS:DW }
- { MAP S4:=SYS:123V1 }
- { MAP S5:=SYS:DOS%OS_VERSION }
- { MAP S6:=SYS:%MACHINE }
- { MAP S7:=SYS:COMMON }
- { COMSPEC = S5:COMMAND.COM }
- { MAP P:=IOL:SNAGATE }
- { MAP S:=IOL:SHARED }
- { MAP *1:=IOL:%LOGIN_NAME }
- { MAP DISPLAY ON }
- { #LASTLOG %LOGIN_NAME }
- { DISPLAY SYS:PUBLIC\NETNEWS.TXT }
- { WAIT }
-
-
- type
- CommandString = string[127];
- TimeString = string[8];
- DateStr = string[18];
-
- var
- Buffer : CommandString;
- CL : CommandString absolute cseg:$80;
- InFile,OutFile : Text;
- Last : string[80];
- Temp : string[12];
-
-
- function time: TimeString;
- type
- regpack = record
- ax,bx,cx,dx,bp,si,di,ds,es,flags: integer;
- end;
-
- var
- recpack: regpack;
- ah,al,ch,cl,dh: byte;
- hour,min,sec: string[2];
-
- begin
- ah := $2c;
- with recpack do
- begin
- ax := ah shl 8 + al;
- end;
- intr($21,recpack);
- with recpack do
- begin
- str(cx shr 8,hour);
- str(cx mod 256,min);
- str(dx shr 8,sec);
- end;
- if Length(min) < 2 then min := '0' + min;
- if Length(sec) < 2 then sec := '0' + sec;
- time := hour+':'+min+':'+sec;
- end;
-
-
-
- function Date: DateStr;
- type
- regpack = record
- ax,bx,cx,dx,bp,si,di,ds,es,flags: integer;
- end;
-
- var
- recpack: regpack;
- month,day: string[2];
- year: string[4];
- mth : string[9];
- dx,cx,mth_num,code: integer;
-
- begin
- with recpack do
- begin
- ax := $2a shl 8;
- end;
- MsDos(recpack);
- with recpack do
- begin
- str(cx,year);
- str(dx mod 256,day);
- str(dx shr 8,month);
- end;
- if Length(month) < 2 then month := '0' + month;
- if Length(day) < 2 then day := '0' + day;
- val(month,mth_num,code);
- case mth_num of
- 1 : mth := 'January';
- 2 : mth := 'February';
- 3 : mth := 'March';
- 4 : mth := 'April';
- 5 : mth := 'May';
- 6 : mth := 'June';
- 7 : mth := 'July';
- 8 : mth := 'August';
- 9 : mth := 'September';
- 10 : mth := 'October';
- 11 : mth := 'November';
- 12 : mth := 'December';
- end;
- date := mth+' '+day+', '+year;
- end;
-
- begin
- Textcolor(LightGreen);
-
- Last := '............';
- Buffer := CL;
- Delete(Buffer,1,1);
- Temp := Buffer + '.LOG';
- {$i-}
- Assign(Infile,Temp);
- Reset(Infile);
- Readln(Infile,Last);
- if IOresult > 0 then begin
- Textcolor(Yellow);
- WriteLn('No LAST-LOGIN record found for ID .. [',Buffer,']');
- Writeln('Creating ... ',Temp)
- end
- else begin
- WriteLn('Last Login for ',Buffer,' occurred at : ',Last);
- Close(Infile)
- end;
- {$i+}
- Assign(Outfile,Temp);
- ReWrite(Outfile);
- WriteLn(Outfile,time,' on ',date);
- Close(Outfile)
- end.